<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});


//Route::get('say', function () {
//    return view('say'); // 这个是模版
//});
//
//Route::get('/read','TaskController@read');

// 任何类型参数都可以传递
//Route::get('/task/getParams/{id}','TaskController@getParams');

// 只能传递0-9的数字
//Route::get('/task/getParams/{id}','TaskController@getParams')
//            ->where('id','[0-9]+');

// 只能传递a-z的字母
//Route::get('/task/getParams/{id}','TaskController@getParams')
//    ->where('id','[a-z]+');

//  id只能0-9的数字,name只能是a-z字母
//Route::get('/task/getUserInfo/{id}/{name}','TaskController@userInfo')
//    ->where(['id'=>'[0-9]+','name'=>'[a-z]+']);

// 解除全局限制
//Route::get('/task/getParams/{id}','TaskController@getParams')
//    ->where('id','.*');


// 重定向

//Route::get('say', function () {
//    return view('say'); // 这个是模版
//});

//Route::get('/read','TaskController@read');
//Route:: redirect('read','say',301);

//Route::permanentRedirect('read','say');

//Route::view('test','testView',['id'=>10]);

//Route::get('test','TaskController@test');


//Route::get('/read/url','TaskController@url');
//Route::get('/read/{id}','TaskController@read')->name('abc');

//Route::prefix('api')->get('task',function (){
//    return 'task';
//});


//Route::group(['prefix'=>'api'],function (){
//    Route::get('task',function (){
//        return 'task-api';
//    });
//    Route::get('task2',function (){
//        return 'task-api2';
//    });
//});
//
//Route::prefix('api')->group(function (){
//    Route::get('task',function (){
//        return 'task-api';
//    });
//    Route::get('task2',function (){
//        return 'task-api2';
//    });
//});

//Route::group(['domain' => '127.0.0.1'],function (){
//    Route::get('task2',function (){
//        return 'task-api2';
//    });
//});
//Route::domain('127.0.0.1')->group(function (){
//    Route::get('task2',function (){
//        return 'task-api2';
//    });
//});

//Route::namespace('Admin')->group(function (){});
//Route::group(['namespace' => 'Admin'],function (){});


//Route::group(['as'=>'task.'],function (){
//    Route::get('task','TaskController@read')->name('read');
//});
//
//Route::get('one','OneController');
//
//Route::get('name','TaskController@name')->name('task.name');
//
//Route::get('route',function (){
//    // 当前路由的信息
////    dump(Route::current());
//    //当前路由的名称
//    dump(Route::currentRouteName());
//});
//
//Route::get('data','TaskController@data');
//
////Route::resource('blogs','BlogController')->only(['index']);
//
////Route::resource('blogs','BlogController')->except(['index']);
//
//Route::apiResource('blogs','BlogController');
//
//
//
//// 这个必须放置在最下面，因为执行顺序的原因
//Route::fallback(function (){
//    // 这里可以做很多处理操作 可以自己写404页面 也可以redirect到首页
//    return '404';
//});

Route::get('/user','DataController@index');


